<template>
	<view>
		<view class="uni-padding-wrap uni-common-mt"></view>
			<view class="uni-title uni-common-mt">默认样式</view>
			<view>
				<checkbox value="cb1" checked="true"/>选中
				<checkbox value="cb">未选中
				</checkbox>
			
		</view>
		
		<view class="uni-title uni-common-mt">不同颜色和尺寸</view>
		<view>
			<checkbox-group>
				<label style="background-color: blue;">
					<checkbox value="cb1" checked="true" style="transform:scale(0.7);" />选中
				</label>
				<label>
					<checkbox value="cb"  style="transform:scale(0.7);" />未选中
				</label>
			</checkbox-group>
		</view>
	</view>
	
	<view class="uni-common-mt uni-title">推荐展示样式</view>
	<view class="uni-list">
		<checkbox-group @change="CheckboxChange">
		<!--	<label class="uni-list-cell uni-list-cell-pd" v-for="item in items" :key="item.value" style="background-color: cadetblue;">
				<view>
					<checkbox :value="item.value" :checked="item.value" />
				</view>
				<view>{{item.value}}</view>
			</label> 
			-->
			<label class="list">
				<view>
					<checkbox></checkbox>
					中国
				</view>
			</label>
			<label class="list">
				<view>
					<checkbox></checkbox>
					日本
				</view>
			</label>
			<label class="list">
				<view>
					<checkbox></checkbox>
					美国
				</view>
			</label>
		</checkbox-group>
	</view>
	
	
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			checkboxChange: function (e){
				var item = this.items,
				values = e.detail.value;
				for(var i = 0,lenI = items.length; i < lenI; i++){
					const item = items[i]
					console.log('i:'+i+'---'+item.name+', index:'
					+values.indexOf(item.value)
					+',isCheck:'+item.checked)
					if(values.indexOf(item.value) >= 0){
						this.$set(item,'checked',true)
					}else{
						this.$set(item,'checked',false)
					}
				}
			}
		}
	}
</script>

<style>
	.item{
		margin-bottom: 30rpx;
	}
.list{
	justify-content: flex-start;
	padding: 22rpx 32rpx;
}
.list view{
	padding-bottom:  20rpx;
	border-bottom: 1px solid #d8d8d8;
}
</style>
